<template>
  <div class="bigdiv">
    <el-row>
      <el-col :span="8">
        <div>
          <p>订单状态</p>
          <p>
            <span v-if="orderStatuss == 0">待支付</span>
            <span v-else-if="orderStatuss == 1">已支付</span>
            <span v-else-if="orderStatuss == 2">配货完成</span>
            <span v-else-if="orderStatuss == 3">出库成功</span>
            <span v-else-if="orderStatuss == 4">交易成功</span>
            <span v-else-if="orderStatuss == -1">手动关闭</span>
            <span v-else-if="orderStatuss == -2">超时关闭</span>
            <span v-else-if="orderStatuss == -3">商家关闭</span>
          </p>
        </div>
      </el-col>
      <el-col :span="8">
        <div>
          <p>创建时间</p>
          <p>{{ createTimes }}</p>
        </div>
      </el-col>
      <el-col :span="8">
        <div>
          <p>订单号</p>
          <p>{{ orderNos }}</p>

        </div>
      </el-col>
    </el-row>
    <el-table :data="tableData" style="width: 100%">

      <el-table-column label="图片" width="180">
        <template #default="scope">
          <!-- {{ goodsCoverImg }} -->
          <img class="img" :src="'http://backend-api-02.newbee.ltd' + scope.row.goodsCoverImg" alt="">
        </template>
      </el-table-column>
      <el-table-column prop="goodsId" label="商品编号" width="180" />
      <el-table-column prop="goodsName" label="商品名" />
      <el-table-column prop="goodsCount" label="商品数量" />
      <el-table-column prop="sellingPrice" label="商品价格" />
    </el-table>
  </div>
</template>

<script setup>
import { onMounted, ref } from 'vue';
import axios from '../../ajax';
import { useRouter, useRoute, onBeforeRouteUpdate } from 'vue-router';
let route = useRoute()
const tableData = ref([
])
const orderStatuss = ref(0)
const createTimes = ref('')
const orderNos = ref('')
onMounted(() => {
  getdata(route.query.id)
})


const getdata = async (id) => {
  let { createTime, newBeeMallOrderItemVOS, orderStatus, orderNo } = await axios.get(`/orders/${id}`)
  tableData.value = newBeeMallOrderItemVOS
  orderStatuss.value = orderStatus
  createTimes.value = createTime
  orderNos.value = orderNo
}

</script>

<style lang="scss">
.img {
  width: 100px;
  height: 100px;
}
.bigdiv{
  box-shadow: 0 0 10px #dbdada;
}
</style>